package com.yykj.tencent.im.server.model.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yykj.common.util.serializer.LocalDate2LongSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * 好友
 */
@Data
@Entity
@IdClass(FriendPK.class)
public class Friend {

    @Id
    @ApiModelProperty("用户ID")
    @Column(length = 50,nullable = false)
    private String fromAccount;

    @Id
    @ApiModelProperty("好友ID或群组ID")
    @Column(length = 50,nullable = false)
    private String toAccount;

    @ApiModelProperty("类型：好友 F; 群 G")
    @Column(length = 10)
    private String type = "F";

    @ApiModelProperty("更新时间")
    @JsonSerialize(using = LocalDate2LongSerializer.class)
    private LocalDateTime updateTime;

    @ApiModelProperty("交互次数")
    private Integer number = 0;

    @ApiModelProperty("运行环境")
    @Column(length = 10)
    private String environment;

}
